package panel.background
{
	import assists.Lang;
	import assists.SizeManager;
	import assists.URI;
	import assists.resource.ResourceLoader;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.display.Stage;
	
	import inerface.IBackgroundPanel;
	
	public class BackgroundPanel extends Sprite implements IBackgroundPanel
	{
		private var backContainer:Sprite;
		private var _loader:ResourceLoader;
		private var _stage:Stage;
		private var _lang:Lang;
		private var _uri:URI;
		
		public function BackgroundPanel()
		{
			
		}
		
		public function init(stage:Stage,loader:ResourceLoader,lang:Lang,uri:URI = null):void
		{
			
			_stage = stage;
			_loader = loader;
			_lang = lang;
			_uri = uri;
			
			backContainer = new Sprite;
			this.addChildAt(backContainer,0);
		}
		
		public function get content():Sprite
		{
			return this;
		}
		
		public function addBackground(url:String):void
		{
			var img:Bitmap = new _loader.uiManager.backgroundWallPaper as Bitmap;
			backContainer.addChild(img);
			reppsition();
		}
		
		private function reppsition():void
		{
//			backContainer.x = (_stage.stageWidth - backContainer.width) / 2;
//			backContainer.y = (_stage.stageHeight - backContainer.height) / 2;
			SizeManager.changeImageScale(backContainer);
		}
		
		public function clear():void
		{
			
		}
		
	}
}